预备工作
- 从MXNET model zoo 中下载对应的模型参数及json配置文件 链接
- 下载 synset.txt 便于程序读取分类结果
源码实现
1 | import mxnet as mx |
1 | def loadModel(modelname): |
实验结果
1 | filename = sys.argv[1] |
*** Inception v3
Loaded in 20.42 milliseconds
Predicted in 0.19 millsecond
[(0.34680301, 'n02112018 Pomeranian')]
*** squeezenet_v1.0
Loaded in 2.94 milliseconds
Predicted in 0.08 millsecond
[(0.22845435, 'n02326432 hare')]
*** squeezenet_v1.1
Loaded in 2.93 milliseconds
Predicted in 0.08 millsecond
[(0.71776724, 'n02123045 tabby, tabby cat')]
*** nin
Loaded in 5.85 milliseconds
Predicted in 0.14 millsecond
[(0.67466462, 'n02119022 red fox, Vulpes vulpes')]